SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		EM
-- Create date: 2012-07-04
-- Description:	del phone alert
-- =============================================
alter TRIGGER dbo.DelPhone
   ON  dbo.phones 
   AFTER DELETE
AS 
BEGIN

	SET NOCOUNT ON;
declare @phone varchar(20), @Code varchar(160), @h int, @comment varchar(255),  @uid int
select @uid=uid, @phone=isnull(phone,'unknown'), @h=datepart(hh,dt) from deleted i
--print @phone_id
--print @h
--print @phone
set @Code='DelPhone '+@phone+' '+convert(varchar,getdate(),102)+' '+cast(@h as varchar)
set @comment='hour: '+cast(@h as varchar)
EXEC	sms_p.[dbo].[sp_SetSMSEmailNotification]
		@SMS_ID = @uid,
		@Code =@Code,
		@Comment = @comment


END
GO
